import java.io.File;
import java.io.IOException;

public class Demo1 {
    public static void main1(String[] args) throws IOException {
        File file = new File("./text.txt");
        System.out.println(file.getParent());
        System.out.println(file.getName());
        System.out.println(file.getPath());
        System.out.println(file.getAbsoluteFile());
        System.out.println(file.getCanonicalPath());
        System.out.println(file.exists());
    }

    public static void main2(String[] args) throws IOException {
        File file = new File("./text.txt");
        file.createNewFile();
        System.out.println(file.isDirectory());
        System.out.println(file.isFile());
    }

    public static void main(String[] args) {
        File file = new File("./text.txt");
        System.out.println("文件是否存在：" + file.exists());
        file.delete();
        System.out.println("文件是否存在：" + file.exists());
    }
}
